namespace Web.Control.WWW.Wiki
{
    using System;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using Lx.Web.Common.UI;
    using Lx.Web.Common.ControlsUI;
    using System.Collections;
    using System.Collections.Generic;
    using System.Xml;
    using System.IO;

    using BLF;
    using BLF.WWW_WWW.Wiki;
    using Model.WWW_WWW.Wiki;

    public class AllLanguageList : BaseControl
    {
        protected Literal lTages;
        protected Literal lLCount;

        protected Repeater rptTags;
        protected Repeater rptLB;

        protected int RecordCount = 0;
        protected int PageIndex = 1;
        protected override void OnLoad(EventArgs e)
        {
            int l = 10;
            if (lLCount!=null) int.TryParse(lLCount.Text, out l);
            int c= 10;
            if (lTages != null) int.TryParse(lTages.Text, out c);
            if (!string.IsNullOrEmpty(Request["p"]))
            {
                if (Request["p"] == "L")
                {
                    PageIndex = 999;
                }
                else
                {
                    int.TryParse(Request["p"], out PageIndex);
                }
            }
            if (PageIndex < 1) PageIndex = 1;
            ArrayList al = Wiki.GetAllLanguageData(PageIndex,l, c);
            if (rptLB != null)
            {
                rptLB.DataSource = (List<LearnLangInBaseLangInfo>)al[0];
                rptLB.DataBind();
            }
            if (rptTags != null)
            {
                rptTags.DataSource = (List<CategoryInfo>)al[1];
                rptTags.DataBind();
            }
            RecordCount = (int)al[2];
            int pCount = (int)Math.Ceiling(((decimal)RecordCount) / ((decimal)l));
            if (PageIndex > pCount) PageIndex = pCount;
            base.OnLoad(e);
        }
    }
}
